package com.ljy.my_study.rpc传输对象.rpc;

import java.io.IOException;
import java.io.ObjectInputStream;
import java.net.ServerSocket;
import java.net.Socket;

import com.ljy.my_study.rpc传输对象.domain.Person;

/**
 * @author James
 * @date 2018年6月5日
 */
public class SocketServer {
	public static void main(String[] args) {
		ServerSocket server =null;
		try {
			server= new ServerSocket(9999);
			Socket clientSocket = server.accept();
			ObjectInputStream in = new ObjectInputStream(clientSocket.getInputStream());
			try {
				Object inObj = in.readObject();
				System.out.println(inObj);
				Person o=(Person)inObj;
				System.out.println(o);
			} catch (ClassNotFoundException e) {
				e.printStackTrace();
			}
		} catch (IOException e) {
			e.printStackTrace();
		}finally {
			if(server!=null) {
				try {
					server.close();
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
		}
	}
}
